package com.mingdinggroup.app.util;

import android.content.Context;
import android.content.DialogInterface;
import android.support.v7.app.AlertDialog;

/**
 * 作者：woodnaonly on 2017/2/23 16:18
 * 邮箱：497917264@qq.com
 * 内容：
 * 备注：
 */
public class DialogUtil {

    public interface OnClickListener {

        public void Button1onClick();

        public void Button2onClick();
    }

    public static void showDialog(Context context, String title, String Message, String Button1Text,
                                  String Button2Text, OnClickListener onClickListener) {
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        // 设置参数
        builder.setTitle(title).setMessage(Message)
                .setPositiveButton(Button1Text, new DialogInterface.OnClickListener() {// 积极

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        onClickListener.Button1onClick();

                    }
                }).setNegativeButton(Button2Text, new DialogInterface.OnClickListener() {// 消极

            @Override
            public void onClick(DialogInterface dialog, int which) {
                onClickListener.Button2onClick();
            }
        });
        builder.create().show();
    }
}
